﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using DATA.BusinessObjects;

namespace Presentation
{
    public partial class frmThayDoiTiLePhuThu : Form
    {
        public frmThayDoiTiLePhuThu()
        {
            InitializeComponent();
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void frmThayDoiTiLePhuThu_Load(object sender, EventArgs e)
        {
            IList<Phuthu> list = PhuThuBUS.LayPhuThu();

            cbxThuTuKhachTinhPhuThu.DataSource = list;
            cbxThuTuKhachTinhPhuThu.DisplayMember = "ThuTuKhachPhuThu";
            cbxThuTuKhachTinhPhuThu.ValueMember = "Id";
        }

        private void cbxThuTuKhachTinhPhuThu_SelectedIndexChanged(object sender, EventArgs e)
        {
            Phuthu pt = (Phuthu) cbxThuTuKhachTinhPhuThu.SelectedItem;
            txtPhuThu.Text = pt.TyLePhuThu.ToString();
        }

        private void btnThayDoi_Click(object sender, EventArgs e)
        {
            Phuthu pt = (Phuthu)cbxThuTuKhachTinhPhuThu.SelectedItem;
            pt.TyLePhuThu = int.Parse(txtPhuThu.Text);

            PhuThuBUS.CapNhatPhuThu(pt);

            MessageBox.Show("Đã thay đổi thành công!!!");
        }
    }
}
